package com.gupaoedu.vip.pattern.proxy.dynamicproxy.jdkproxy;

import com.gupaoedu.vip.pattern.proxy.Person;

import java.lang.reflect.Method;

/** Created by Tom on 2019/3/10. */
public class JDKProxyTest {

  public static void main(String[] args) {
    try {

      Person obj = new JDKMeipo().getInstance(new Girl());
      System.out.println(obj.getClass().getName());
      obj.findLove2();

      Method method = obj.getClass().getMethod("findLove", null);
      method.invoke(obj);

      // obj.findLove();

      // $Proxy0
      //            byte [] bytes = ProxyGenerator.generateProxyClass("$Proxy0",new
      // Class[]{Person.class});
      //            FileOutputStream os = new FileOutputStream("E://$Proxy0.class");
      //            os.write(bytes);
      //            os.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
